Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
Reveal more text on click for multiple "show more" buttons. Duplicate didn't work

This opens more text when I click a button. Now I need more of these on a web page. I duplicated the function and renamed in const lines the names to menubutton2 and dropdownmenu3 but the second button doesn't work

import wixAnimations from 'wix-animations';

$w.onReady(function() {
  activeMenu();
});

function activeMenu() {
  const menuButton = $w('#menuButton');
  const dropdwonMenu = $w('#dropdownMenu');
  const dropdownBoxHeight = 0;
  const dropdownAnimation =
    wixAnimations.timeline().add(dropdwonMenu, {
      y: 0,
      duration: 100
    });

  wixAnimations.timeline().add(dropdwonMenu, {
    y: -
      dropdownBoxHeight
  }).play();

  menuButton.onClick(() => {
    dropdwonMenu.collapsed ? openMenu() : closeMenu();
  });

  dropdownAnimation.onReverseComplete(() => {
    dropdwonMenu.collapse();
  });

  function openMenu() {
    dropdwonMenu.expand().then(() => {
      dropdownAnimation.play();
    })
  }

  function closeMenu() {
    dropdownAnimation.reverse();
  }
}

import wixAnimations from 'wix-animations';
$w.onReady(function() {
  activeMenu();
});

function activeMenu() {
  const menuButton = $w('#menuButton2');
  const dropdwonMenu = $w('#dropdownMenu2');
  const dropdownBoxHeight = 0;
  const dropdownAnimation =
    wixAnimations.timeline().add(dropdwonMenu, {
      y: 0,
      duration: 100
    });

  wixAnimations.timeline().add(dropdwonMenu, {
    y: -
      dropdownBoxHeight
  }).play();

  menuButton.onClick(() => {
    dropdwonMenu.collapsed ? openMenu() : closeMenu();
  });

  dropdownAnimation.onReverseComplete(() => {
    dropdwonMenu.collapse();
  });

  function openMenu() {
    dropdwonMenu.expand().then(() => {
      dropdownAnimation.play();
    })
  }

  function closeMenu() {
    dropdownAnimation.reverse();
  }
}


       
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!